package seven.test_7_23;

import java.util.Scanner;

public class TestMain3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int count = (int) Math.sqrt(x);
        int tmp = count * count;
        if(tmp == x) {
            System.out.println(0);
            return;
        }
        int t2 = (count + 1) * (count + 1);
        System.out.println((t2 - x) > (x - tmp) ? tmp : t2);
    }
}
